from flask import Flask
from cons import Config
#导入sqlalchmy
from flask_sqlalchemy import SQLAlchemy
#迁移的包
from flask_migrate import Migrate,MigrateCommand
#执行脚本的包
from flask_script import Manager
app = Flask(__name__)
app.config.from_object(Config)
#初始化
db = SQLAlchemy(app)
#实例化manage
manage = Manager(app)
#实例化migrate
migrate = Migrate(app,db)
manage.add_command('db',MigrateCommand)

#orm方式创建表,学生表,id,name,age
class User(db.Model):
    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    name = db.Column(db.String(80), unique=True,default='')
    age = db.Column(db.Integer,default=0)

if __name__ == "__main__":
    app.run()
    # manage.run()
